#ifndef XME802_4_H
#define XME802_4_H

#include <boardbase.h>
#include <core_debug.h>
#include <plc_task.h>
#include <plc_retain.h>

// #include "flashFs.h"
#define X1 PC2
#define X2 PC3
#define X3 PA0
#define X4 PA1
#define XA1 PB0
#define XP1 PB1
#define YA1 PA4
#define YA2 PA5
#define Y1 PF11
#define Y2 PF12
#define Y3 PF13
#define Y4 PF14
#define Y5 PF15
#define Y6 PG0
#define NOFS 1

class hwboard : public boardBase {
public:
    hwboard();

    void beep(bool onoff);


    int begin(u32 tick) override;


    void board_output(u32 tick) override;

    void flashClear() override;

    void initReset() override;

    int get_dbg_jmpr_get() override;

    int get_rst_jmpr_get() override;

    int modbus_cb_read(u16 start_addr, u16 word_count, u16 *data_words) override;

    int modbus_cb_write(u16 start_addr, u16 word_count, u16 *data_words) override;

    int run(u32 tick) override { return 0; }

    int diag(u32 tick) override;

    void plc_run_start() override;

    void plc_run_end() override;

    int load_app() override;

    int test_hw() override;

    void Poll(u32) override;

    static void plc_run_stop();

    static void plc_run_error();

    static void plc_run_empty();

    mem_block *get_retain() override;

    void led_run(u8) override;

    void led_err(u8) override;

    u32 last_led_tick;

    void boot_mode_enter();
};

#ifdef LFS
extern FlashFs flash_fs;
#endif
extern "C"
{
void plc_set_state(u8 state);
}

#endif
